*THIS DO-FILE REPRODUCES THE RESULTS IN FINSERAAS, HEATH, LANGSÆTHER & SMETS (2024) "How Group Appeals Shape Group-Party Linkages in Two Political Systems" (JOP).
*To run the do-file without making any changes to the file you need to download the Stata data-files and save them on the same folder as this do-file.
*Before running the file you need to install the packages coefplot and grc1leg2 using the command ssc install. To do this you need internet connection.
*The code runs on Stata version 18

global dimensions_uk age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu conflict_appeal solidarity_appeal

global dimensions_no age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort conflict_appeal solidarity_appeal

global dimensions_interactions_uk age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu  conflict_appeal solidarity_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_euXwc conflict_appealXwc solidarity_appealXwc

global dimensions_interactions_no age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort  conflict_appeal solidarity_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_abortXwc conflict_appealXwc solidarity_appealXwc

********************************************************************************
*FIGURE 1***********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg selected $dimensions_no if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_no if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_class_no.gph", replace

reg selected $dimensions_interactions_no workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_diff_no.gph", replace

clear 
use  "Data_Britain.dta"

reg selected $dimensions_uk if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_uk if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_class_uk.gph", replace
 
reg selected $dimensions_interactions_uk workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2)   xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_diff_uk.gph", replace


gr combine "amce_class_no.gph" "amce_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "main_no.gph", replace
gr combine "amce_class_uk.gph" "amce_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "main_uk.gph", replace
grc1leg2 "main_no.gph" "main_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figure1.gph", replace
gr export  "figure1.pdf",as(pdf) replace


********************************************************************************
*FIGURE 2***********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg rightrating $dimensions_no if workingclass==0, cl(RespondentSerial)
est store wc0
reg rightrating $dimensions_no if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: AMCE by class", size(medsmall))
graph save "amce_rightrating_class_no.gph", replace
 
reg represented $dimensions_no if workingclass==0, cl(RespondentSerial)
est store wc0
reg represented $dimensions_no if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: AMCE by class", size(medsmall))
graph save "amce_represented_class_no.gph", replace
 

clear 
use  "Data_Britain.dta"
 
reg rightrating $dimensions_uk if workingclass==0, cl(RespondentSerial)
est store wc0
reg rightrating $dimensions_uk if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid)  xsc(r(-1 1)) xlab(-1 (.5) 1) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: AMCE by class", size(medsmall))
graph save "amce_rightrating_class_uk.gph", replace
 
 
reg represented $dimensions_uk if workingclass==0, cl(RespondentSerial)
est store wc0
reg represented $dimensions_uk if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: AMCE by class", size(medsmall))
graph save "amce_represented_class_uk.gph", replace


gr combine "amce_rightrating_class_no.gph"  "amce_represented_class_no.gph",   imargin(small)   title("Norway", size(small))
gr save "rightscale_represented_no.gph", replace
gr combine "amce_rightrating_class_uk.gph"  "amce_represented_class_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "rightscale_represented_uk.gph", replace
grc1leg2 "rightscale_represented_no.gph" "rightscale_represented_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
 
gr save "figure2.gph", replace
gr export  "figure2.pdf",as(pdf) replace



********************************************************************************
*FIGURE A2**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

foreach x in $dimensions_no class_appeal2{
	reg selected i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg selected i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_abort0  class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_abort1 class_appeal21, label(Working class)), drop(_cons)  legend(off) xsc(r(.4 .6)) xlab(.4 (.05) .6) xline(.5, lpat(shortdash_dot)) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Marginal means by class", size(medsmall))  
graph save "mm_class_no.gph", replace


foreach x in $dimensions_no turnout_appeal{
	reg selected workingclass if `x'==0, cl(RespondentSerial)
	est store `x'0
	reg selected workingclass if `x'==1, cl(RespondentSerial)
	est store `x'1
}
coefplot  age_candidate0  age_candidate1 gender_candidate0 gender_candidate1 class_candidate0 class_candidate1 rural_candidate0 rural_candidate1 policy_welfare0 policy_welfare1 policy_immigration0 policy_immigration1 policy_environment0 policy_environment1 policy_abort0 policy_abort1   turnout_appeal1   conflict_appeal1   solidarity_appeal1, drop(_cons) eqrename(age_candidate0="30"  age_candidate1="60" gender_candidate0="Female" gender_candidate1="Male" class_candidate0="Middle class" class_candidate1="Working class" rural_candidate0="Urban" rural_candidate1="Rural" policy_welfare1="Expand welfare state" policy_welfare0="Reduce taxes" policy_immigration1="Restrict immigration" policy_immigration0="Liberal immigration" policy_environment0="Incease CO2 tax" policy_environment1="Decrease CO2 tax" policy_abort0 ="No change in abortion" policy_abort1="More liberal abortion"  turnout_appeal1="Turnout appeal" conflict_appeal1="Conflict appeal" solidarity_appeal1="Solidarity appeal") ylabel(, angle(0) nogrid) legend(off)  graphr(color(white))  xline(0, lpat(shortdash_dot)) plotregion(style(none)) color(black) ciopts(lpattern(line) lcolor(black)) ms(O)  scale(.8) nooffsets swap aseq title("Differences in marginal means by class", size(medsmall))
graph save "mm_diff_no.gph", replace


clear 
use  "Data_Britain.dta"

foreach x in $dimensions_uk class_appeal2{
	reg selected i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg selected i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_eu0    class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_eu1   class_appeal21, label(Working class)), drop(_cons)  legend(off)  xline(.5, lpat(shortdash_dot)) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Marginal means by class", size(medsmall))  
graph save "mm_class_uk.gph", replace


foreach x in $dimensions_uk turnout_appeal{
	reg selected workingclass if `x'==0, cl(RespondentSerial)
	est store `x'0
	reg selected workingclass if `x'==1, cl(RespondentSerial)
	est store `x'1
}
coefplot  age_candidate0  age_candidate1 gender_candidate0 gender_candidate1 class_candidate0 class_candidate1 rural_candidate0 rural_candidate1 policy_welfare0 policy_welfare1 policy_immigration0 policy_immigration1 policy_environment0 policy_environment1 policy_eu0 policy_eu1   turnout_appeal1   conflict_appeal1   solidarity_appeal1, drop(_cons) eqrename(age_candidate0="30"  age_candidate1="60" gender_candidate0="Female" gender_candidate1="Male" class_candidate0="Middle class" class_candidate1="Working class" rural_candidate0="Urban" rural_candidate1="Rural" policy_welfare1="Expand welfare state" policy_welfare0="Reduce taxes" policy_immigration0="Liberal immigration" policy_immigration1="Restrict immigration"policy_environment0="Prioritize climate" policy_environment1="Prioritize growth" policy_eu0="EU coorporation" policy_eu1 ="EU independence" turnout_appeal1="Turnout appeal" conflict_appeal1="Conflict appeal" solidarity_appeal1="Solidarity appeal") ylabel(, angle(0) nogrid) legend(off)  graphr(color(white))  xline(0, lpat(shortdash_dot)) plotregion(style(none)) color(black) ciopts(lpattern(line) lcolor(black)) ms(O) scale(.8) nooffsets swap aseq title("Differences in marginal means by class", size(medsmall))
graph save "mm_diff_uk.gph", replace


gr combine "mm_class_no.gph" "mm_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "mainmm_no.gph", replace
gr combine "mm_class_uk.gph" "mm_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "mainmm_uk.gph", replace
grc1leg2 "mainmm_no.gph" "mainmm_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA2.gph", replace
gr export  "figureA2.pdf",as(pdf) replace



********************************************************************************
*FIGURE A3**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg rightrating $dimensions_interactions_no workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no workingclass) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: Differences in AMCE by class", size(medsmall)) 
graph save "amce_rightrating_diff_no.gph", replace

clear 
use  "Data_Britain.dta"

reg rightrating $dimensions_interactions_uk workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk workingclass) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: Differences in AMCE by class", size(medsmall)) 
graph save "amce_rightrating_diff_uk.gph", replace


gr combine "amce_rightrating_class_no.gph"  "amce_rightrating_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "rightrating_no.gph", replace
gr combine "amce_rightrating_class_uk.gph"  "amce_rightrating_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "rightrating_uk.gph", replace
grc1leg2 "rightrating_no.gph" "rightrating_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA3.gph", replace
gr export  "figureA3.pdf",as(pdf) replace


********************************************************************************
*FIGURE A4**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg represented $dimensions_interactions_no workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no workingclass) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: Differences in AMCE by class", size(medsmall)) 
graph save "amce_represented_diff_no.gph", replace

clear 
use  "Data_Britain.dta"

reg represented $dimensions_interactions_uk workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk workingclass) ylabel(, nogrid) xsc(r(-.4 .6)) xlab(-.4 (.2) .6) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: Differences in AMCE by class", size(medsmall)) 
graph save "amce_represented_diff_uk.gph", replace

gr combine "amce_represented_class_no.gph"  "amce_represented_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "represented_no.gph", replace
gr combine "amce_represented_class_uk.gph"  "amce_represented_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "represented_uk.gph", replace
grc1leg2 "represented_no.gph" "represented_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA4.gph", replace
gr export  "figureA4.pdf",as(pdf) replace



********************************************************************************
*FIGURE A5**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

foreach x in $dimensions_no class_appeal2{
	reg rightrating i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg rightrating i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_abort0  class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_abort1 class_appeal21, label(Working class)), drop(_cons)  legend(off)  xsc(r(3.4 4.4)) xlab(3.4 (.2) 4.4) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: Marginal means by class", size(medsmall))  
graph save "mm_rightrating_class_no.gph", replace


foreach x in $dimensions_no class_appeal2{
	reg represented i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg represented i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_abort0  class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_abort1 class_appeal21, label(Working class)), drop(_cons)  legend(off)  xsc(r(3.3 4.0)) xlab(3.2 (.2) 4.0) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: Marginal means by class", size(medsmall))  
graph save "mm_represented_class_no.gph", replace

clear 
use "Data_Britain.dta"

foreach x in $dimensions_uk class_appeal2{
	reg rightrating i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg rightrating i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_eu0    class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_eu1   class_appeal21, label(Working class)), drop(_cons)  legend(off)  xsc(r(3.4 4.4)) xlab(3.4 (.2) 4.4)  plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Rightscale: Marginal means by class", size(medsmall))  
graph save "mm_rightrating_class_uk.gph", replace


foreach x in $dimensions_uk class_appeal2{
	reg represented i.`x'  if workingclass==0,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'0
	reg represented i.`x'  if workingclass==1,  cl(RespondentSerial)
	margins i.`x', post
	est store `x'1
} 
 

coefplot  (age_candidate0    gender_candidate0 class_candidate0  rural_candidate0  policy_welfare0  policy_immigration0  policy_environment0  policy_eu0    class_appeal20, label(Middle class) color(black))  (age_candidate1    gender_candidate1 class_candidate1  rural_candidate1  policy_welfare1  policy_immigration1  policy_environment1  policy_eu1   class_appeal21, label(Working class)), drop(_cons)  legend(off)  xsc(r(3.3 4.0)) xlab(3.2 (.2) 4.0)  plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Represented: Marginal means by class", size(medsmall))  
graph save "mm_represented_class_uk.gph", replace

gr combine "mm_rightrating_class_no.gph"  "mm_represented_class_no.gph",   imargin(small)   title("Norway", size(small))
gr save "mm_rightrating_represented_no.gph", replace
gr combine  "mm_rightrating_class_uk.gph"  "mm_represented_class_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "mm_rightrating_represented_uk.gph", replace
grc1leg2 "mm_rightrating_represented_no.gph" "mm_rightrating_represented_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)


gr save "figureA5.gph", replace
gr export  "figureA5.pdf",as(pdf) replace


********************************************************************************
*FIGURE A6**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

global dimensions2 age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort class_appeal
global dimensions_interactions2 age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort  class_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_abortXwc class_appealXwc  

reg selected $dimensions2 if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions2 if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_alt1_no.gph", replace
 
reg selected $dimensions_interactions2 workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions2 workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_alt1_diff_no.gph", replace

clear 
use "Data_Britain.dta"

global dimensions2 age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu class_appeal

global dimensions_interactions2 age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu  class_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_euXwc class_appealXwc  

reg selected $dimensions2 if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions2 if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_alt1_uk.gph", replace
 
reg selected $dimensions_interactions2 workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions2 workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_alt1_diff_uk.gph", replace

gr combine "amce_alt1_no.gph" "amce_alt1_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "binaryappeal_no.gph", replace
gr combine "amce_alt1_uk.gph" "amce_alt1_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "binaryappeal_uk.gph", replace
grc1leg2 "binaryappeal_no.gph" "binaryappeal_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA6.gph", replace
gr export  "figureA6.pdf",as(pdf) replace


********************************************************************************
*FIGURE A7**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

global dimensions_full age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort attention_appeal powerful_appeal interests_appeal common_appeal
 
global dimensions_int_full age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort attention_appeal powerful_appeal interests_appeal common_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_abortXwc attention_appealXwc powerful_appealXwc interests_appealXwc common_appealXwc

reg selected $dimensions_full if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_full if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_alt2_no.gph", replace

reg selected $dimensions_int_full workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_full workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_alt2_diff_no.gph", replace

clear 
use "Data_Britain.dta"

global dimensions_full age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu attention_appeal powerful_appeal interests_appeal common_appeal

global dimensions_int_full age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu attention_appeal powerful_appeal interests_appeal common_appeal age_candidateXwc gender_candidateXwc class_candidateXwc rural_candidateXwc policy_welfareXwc policy_immigrationXwc policy_environmentXwc policy_euXwc attention_appealXwc powerful_appealXwc interests_appealXwc common_appealXwc
 
reg selected $dimensions_full if workingclass==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_full if workingclass==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class", size(medsmall))
graph save "amce_alt2_uk.gph", replace

reg selected $dimensions_int_full workingclass, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_full workingclass) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class", size(medsmall)) 
graph save "amce_alt2_diff_uk.gph", replace

gr combine "amce_alt2_no.gph" "amce_alt2_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "fullappeal_no.gph", replace
gr combine "amce_alt2_uk.gph" "amce_alt2_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "fullappeal_uk.gph", replace
grc1leg2 "fullappeal_no.gph" "fullappeal_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA7.gph", replace
gr export  "figureA7.pdf",as(pdf) replace


********************************************************************************
*FIGURE A8**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg male $dimensions_no, cl(RespondentSerial)
est store m1
reg uniedu $dimensions_no, cl(RespondentSerial)
est store m2
reg rightscale $dimensions_no, cl(RespondentSerial)
est store m3

coefplot  (m1, label(Male) color(black) ciopts(lcolor(black))) (m2, label(University education)  color(gs8) ciopts(lcolor(gs8))) (m3, label(Rightscale)  color(gs12) ciopts(lcolor(gs12))),  drop(_cons) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(region(col(white))cols(3)) plotregion(style(none)) lwidth(vvthin)  ms(O) scale(.8) title("Norway", size(medsmall))
graph save "balance_no.gph", replace


foreach x in male uniedu rightscale{
	reg `x' $dimensions_no, cl( RespondentSerial )
	test $dimensions_no
}


clear 
use "Data_Britain.dta"

reg male $dimensions_uk, cl(RespondentSerial)
est store m1
reg voted $dimensions_uk, cl(RespondentSerial)
est store m2
reg aged $dimensions_uk, cl(RespondentSerial)
est store m3

coefplot  (m1, label(Male) color(black) ciopts(lcolor(black))) (m2, label(Turnout)  color(gs8) ciopts(lcolor(gs8))) (m3, label(Age)  color(gs12) ciopts(lcolor(gs12))),  drop(_cons) ylabel(, nogrid)  xline(0, lpat(shortdash_dot)) legend(region(col(white)) cols(3)) plotregion(style(none)) lwidth(vvthin)  ms(O) scale(.8) title("Britain", size(medsmall))
graph save "balance_uk.gph", replace


foreach x in male voted aged{
	reg `x' $dimensions_uk, cl( RespondentSerial )
	test $dimensions_uk
}

 
gr combine "balance_no" "balance_uk", xcommon  imargin(small)
gr save "balance_fig.gph", replace
gr export  "figureA8.pdf",as(pdf) replace


********************************************************************************
*FIGURE A9**********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg selected $dimensions_no if male==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_no if male==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Female) color(black)) (wc1, label(Male)),  drop(_cons) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.1) .15) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by gender", size(medsmall))
graph save "amce_male_no.gph", replace
 
 
global dimensions_int_male age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort  conflict_appeal solidarity_appeal age_candidateXmale gender_candidateXmale class_candidateXmale rural_candidateXmale policy_welfareXmale policy_immigrationXmale policy_environmentXmale policy_abortXmale conflict_appealXmale solidarity_appealXmale

reg selected $dimensions_int_male male, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no male) ylabel(, nogrid) xsc(r(-.15 .1)) xlab(-.15 (.1) .1) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by gender", size(medsmall)) 
graph save "amce_male_diff_no.gph", replace

clear 
use "Data_Britain.dta"

reg selected $dimensions_uk if male==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_uk if male==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Female) color(black)) (wc1, label(Male)),  drop(_cons) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.1) .15)  xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by gender", size(medsmall))
graph save "amce_male_uk.gph", replace

global dimensions_int_male age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu conflict_appeal solidarity_appeal age_candidateXmale gender_candidateXmale class_candidateXmale rural_candidateXmale policy_welfareXmale policy_immigrationXmale policy_environmentXmale policy_euXmale  conflict_appealXmale solidarity_appealXmale

reg selected $dimensions_int_male male, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk male) ylabel(, nogrid) xsc(r(-.15 .1)) xlab(-.15 (.1) .1) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by gender", size(medsmall)) 
graph save "amce_male_diff_uk.gph", replace

gr combine "amce_male_no.gph" "amce_male_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "male_no.gph", replace
gr combine "amce_male_uk.gph" "amce_male_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "male_uk.gph", replace
grc1leg2 "male_no.gph" "male_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA9.gph", replace
gr export  "figureA9.pdf",as(pdf) replace


********************************************************************************
*FIGURE A10*********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg selected $dimensions_no if older==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_no if older==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Young) color(black)) (wc1, label(Old)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by age", size(medsmall))
graph save "amce_age_no.gph", replace

global dimensions_int_old age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_abort  conflict_appeal solidarity_appeal age_candidateXold gender_candidateXold class_candidateXold rural_candidateXold policy_welfareXold policy_immigrationXold policy_environmentXold policy_abortXold conflict_appealXold solidarity_appealXold

reg selected $dimensions_int_old older, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no older) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by age", size(medsmall)) 
graph save "amce_age_diff_no.gph", replace

clear 
use "Data_Britain.dta"

reg selected $dimensions_uk if older==0, cl(RespondentSerial)
est store wc0
reg selected $dimensions_uk if older==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Young) color(black)) (wc1, label(Old)),  drop(_cons) ylabel(, nogrid) xsc(r(-.2 .2)) xlab(-.2 (.1) .2) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by age", size(medsmall))
graph save "amce_age_uk.gph", replace

global dimensions_int_old age_candidate gender_candidate class_candidate rural_candidate policy_welfare policy_immigration policy_environment policy_eu conflict_appeal solidarity_appeal age_candidateXold gender_candidateXold class_candidateXold rural_candidateXold policy_welfareXold policy_immigrationXold policy_environmentXold policy_euXold conflict_appealXmale solidarity_appealXmale
 
reg selected $dimensions_int_old older, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk older) ylabel(, nogrid) xsc(r(-.1 .2)) xlab(-.1 (.1) .2) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by age", size(medsmall)) 
graph save "amce_age_diff_uk.gph", replace

gr combine "amce_age_no.gph" "amce_age_diff_no.gph",   imargin(small)   title("Norway", size(small))
gr save "age_no.gph", replace
gr combine "amce_age_uk.gph" "amce_age_diff_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "age_uk.gph", replace
grc1leg2 "age_no.gph" "age_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA10.gph", replace
gr export  "figureA10.pdf",as(pdf) replace


********************************************************************************
*TABLE A3***********************************************************************
********************************************************************************
*The code produces the estimates for Total effect (TE); Direct effect (NDE); Indirect effect (NIE) as reported in Table A3

clear
use "Data_Norway.dta"

global cdim age_candidate gender_candidate   rural_candidate   policy_immigration policy_environment policy_abort 

mediate (selected $cdim class_candidate policy_welfare)(represented $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate policy_welfare)(represented $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (selected $cdim policy_welfare conflict_appeal solidarity_appeal)(represented $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim policy_welfare conflict_appeal solidarity_appeal)(represented $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate conflict_appeal solidarity_appeal)(represented $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate conflict_appeal solidarity_appeal)(represented $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==0, vce(cl RespondentSerial) nointer

********************************************************************************
*TABLE A4***********************************************************************
********************************************************************************
*The code produces the estimates for Total effect (TE); Direct effect (NDE); Indirect effect (NIE) as reported in Table A4

clear 
use "Data_Britain.dta"

global cdim age_candidate gender_candidate   rural_candidate   policy_immigration policy_environment policy_eu

mediate (selected $cdim class_candidate policy_welfare)(represented $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate policy_welfare)(represented $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (selected $cdim policy_welfare conflict_appeal solidarity_appeal)(represented $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim policy_welfare conflict_appeal solidarity_appeal)(represented $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate conflict_appeal solidarity_appeal)(represented $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (selected $cdim class_candidate conflict_appeal solidarity_appeal)(represented $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==0, vce(cl RespondentSerial) nointer


********************************************************************************
*TABLE A5***********************************************************************
********************************************************************************
*The code produces the estimates for Total effect (TE); Direct effect (NDE); Indirect effect (NIE) as reported in Table A3

clear
use "Data_Norway.dta"

global cdim age_candidate gender_candidate   rural_candidate   policy_immigration policy_environment policy_abort 

mediate (represented $cdim class_candidate policy_welfare)(rightrating $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate policy_welfare)(rightrating $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (represented $cdim policy_welfare conflict_appeal solidarity_appeal)(rightrating $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim policy_welfare conflict_appeal solidarity_appeal)(rightrating $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate conflict_appeal solidarity_appeal)(rightrating $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate conflict_appeal solidarity_appeal)(rightrating $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==0, vce(cl RespondentSerial) nointer


********************************************************************************
*TABLE A6***********************************************************************
********************************************************************************
*The code produces the estimates for Total effect (TE); Direct effect (NDE); Indirect effect (NIE) as reported in Table A4

clear 
use "Data_Britain.dta"

global cdim age_candidate gender_candidate   rural_candidate   policy_immigration policy_environment policy_eu

mediate (represented $cdim class_candidate policy_welfare)(rightrating $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate policy_welfare)(rightrating $cdim class_candidate policy_welfare) (class_appeal2) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (represented $cdim policy_welfare conflict_appeal solidarity_appeal)(rightrating $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim policy_welfare conflict_appeal solidarity_appeal)(rightrating $cdim policy_welfare conflict_appeal solidarity_appeal) (class_candidate) if workingclass==0, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate conflict_appeal solidarity_appeal)(rightrating $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==1, vce(cl RespondentSerial) nointer
mediate (represented $cdim class_candidate conflict_appeal solidarity_appeal)(rightrating $cdim class_candidate conflict_appeal solidarity_appeal) (policy_welfare) if workingclass==0, vce(cl RespondentSerial) nointer

********************************************************************************
*FIGURE A11*********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg selected $dimensions_no if workingclass==0 & hvoter==1, cl(RespondentSerial)
est store wc0
reg selected $dimensions_no if workingclass==1 & hvoter==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.4 .4)) xlab(-.4 (.2) .4)  xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class among Høyre voters", size(medsmall))
graph save "amce_class_h_no.gph", replace
 
reg selected $dimensions_interactions_no workingclass if hvoter==1, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_no workingclass) ylabel(, nogrid)  xsc(r(-.2 .4)) xlab(-.2 (.2) .4) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class among Høyre voters", size(medsmall)) 
graph save "amce_diff_h_no.gph", replace


clear 
use "Data_Britain.dta"

reg selected $dimensions_uk if workingclass==0 & vote_consvlab==1, cl(RespondentSerial)
est store wc0
reg selected $dimensions_uk if workingclass==1 & vote_consvlab==1, cl(RespondentSerial)
est store wc1

coefplot  (wc0, label(Middle class) color(black)) (wc1, label(Working class)),  drop(_cons) ylabel(, nogrid) xsc(r(-.4 .4)) xlab(-.4 (.2) .4) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by class among Conservative voters", size(medsmall))
graph save "amce_class_c_uk.gph", replace
 
reg selected $dimensions_interactions_uk workingclass if vote_consvlab==1, cl(RespondentSerial)
est store wc_int
 
coefplot  wc_int,  drop(_cons $dimensions_uk workingclass) ylabel(, nogrid) xsc(r(-.2 .4)) xlab(-.2 (.2) .4) xline(0, lpat(shortdash_dot)) legend(off) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("Differences in AMCE by class among Conservative voters", size(medsmall)) 
graph save "amce_diff_c_uk.gph", replace

gr combine "amce_class_h_no" "amce_diff_h_no.gph",   imargin(small)   title("Norway", size(small))
gr save "cons_no.gph", replace
gr combine "amce_class_c_uk" "amce_diff_c_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "cons_uk.gph", replace
grc1leg2 "cons_no.gph" "cons_uk.gph",  loff imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA11.gph", replace
gr export  "figureA11.pdf",as(pdf) replace


********************************************************************************
*FIGURE A12*********************************************************************
********************************************************************************

clear
use "Data_Norway.dta"

reg selected $dimensions_no if workingclass==1 & class_candidate==0, cl(RespondentSerial)
est store cc0
reg selected $dimensions_no if workingclass==1 & class_candidate==1, cl(RespondentSerial)
est store cc1

coefplot  (cc0, label(Middle class candidate) color(black)) (cc1, label(Working class candidate)),  keep(conflict_appeal solidarity_appeal) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.05) .15) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by candidate class among working class voters", size(medsmall))
graph save "amce_class_cand_wc_no.gph", replace

reg selected $dimensions_no if workingclass==0 & class_candidate==0, cl(RespondentSerial)
est store cc0
reg selected $dimensions_no if workingclass==0 & class_candidate==1, cl(RespondentSerial)
est store cc1

coefplot  (cc0, label(Middle class candidate) color(black)) (cc1, label(Working class candidate)),  keep(conflict_appeal solidarity_appeal) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.05) .15) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by candidate class among middle class voters", size(medsmall))
graph save "amce_class_cand_mc_no.gph", replace

clear 
use "Data_Britain.dta"

reg selected $dimensions_uk if workingclass==1 & class_candidate==0, cl(RespondentSerial)
est store cc0
reg selected $dimensions_uk if workingclass==1 & class_candidate==1, cl(RespondentSerial)
est store cc1

coefplot  (cc0, label(Middle class candidate) color(black)) (cc1, label(Working class candidate)),  keep(conflict_appeal solidarity_appeal) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.05) .15) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by candidate class among working class voters", size(medsmall))
graph save "amce_class_cand_wc_uk.gph", replace

 
reg selected $dimensions_uk if workingclass==0 & class_candidate==0, cl(RespondentSerial)
est store cc0
reg selected $dimensions_uk if workingclass==0 & class_candidate==1, cl(RespondentSerial)
est store cc1

coefplot  (cc0, label(Middle class candidate) color(black)) (cc1, label(Working class candidate)),  keep(conflict_appeal solidarity_appeal) ylabel(, nogrid) xsc(r(-.15 .15)) xlab(-.15 (.05) .15) xline(0, lpat(shortdash_dot)) legend(region(col(white))) plotregion(style(none)) lwidth(vvthin) ms(O) scale(.8) title("AMCE by candidate class among middle class voters", size(medsmall))
graph save "amce_class_cand_mc_uk.gph", replace

gr combine  "amce_class_cand_wc_no.gph" "amce_class_cand_mc_no.gph",   imargin(small)   title("Norway", size(small))
gr save "class_int_no.gph", replace
gr combine "amce_class_cand_wc_uk.gph" "amce_class_cand_mc_uk.gph",   imargin(small)   title("Britain", size(small))
gr save "class_int_uk.gph", replace
grc1leg2 "class_int_no.gph" "class_int_uk.gph",  leg("class_int_no.gph") imargin(tiny)  labsize(1.4)  lms(tiny) col(1)
gr_edit plotregion1.graph1.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)
gr_edit plotregion1.graph2.plotregion1.graph2.yaxis1.draw_view.setstyle, style(no)

gr save "figureA12.gph", replace
gr export  "figureA12.pdf",as(pdf) replace